//
//  GSCommentButton.m
//  GameSky
//
//  Created by lanou on 16/1/15.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSCommentButton.h"

@implementation GSCommentButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {        
        self.inputAccessoryView = [[GSInputView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 150)];
        // 监听键盘弹出;
        [kNotificationCenter addObserver:self selector:@selector(changeFirstResponder) name:UIKeyboardWillShowNotification object:nil];
    }
    return self;
}
// 通知方法;
- (void)changeFirstResponder
{
    [self.inputAccessoryView.textView becomeFirstResponder];
    
    [self resignFirstResponder];
}
// 移除通知;
- (void)dealloc
{
    [kNotificationCenter removeObserver:self];
}

// 本类对象可成为第一响应者;
- (BOOL)canBecomeFirstResponder
{
    return YES;
}

#pragma mark - UIKeyInput代理方法

- (BOOL)hasText
{
    return YES;
}
- (void)insertText:(NSString *)text
{
    
}
- (void)deleteBackward
{
    
}

@end
